pages != find pages -type f -name '*.md' | sed 's/^pages/public/; s/\.md$$/.html/'
taxa != find taxa -type f -name 'index.md' | sed 's,^,public/,; s/\.md$$/.html/'

.PHONY: all
all: $(pages) $(taxa)

public/%.html: pages/%.md scripts/page.sh env.sh
	mkdir -p $$(dirname "$@")
	sh scripts/page.sh "$<" >"$@"

public/taxa/%/index.html: taxa/%/index.md scripts/taxon.sh env.sh
	mkdir -p $$(dirname "$@")
	sh scripts/taxon.sh $$(dirname "$<") >"$@"

public/taxa/%/index.html: taxa/%/index.md scripts/taxon.sh env.sh taxa/%/synonyms
	mkdir -p $$(dirname "$@")
	sh scripts/taxon.sh $$(dirname "$<") >"$@"

.PHONY: clean
clean:
	rm -r public
